package com.Telien.app.user.service;

import java.util.ArrayList;
import java.util.List;

import com.Teilen.app.db.main.DBWrapper;
import com.Telien.app.request.object.DriverRequest;

public class DriverRequestManagementService {
	ArrayList<DriverRequest> sysRequests = new ArrayList<DriverRequest>();
	DBWrapper dbWrapper;
	
	public DriverRequestManagementService() {
		populateRequests();
	}
	
	public DriverRequest getRequestAtId(int id) {
		for (DriverRequest request : sysRequests) {
			
			if (Integer.parseInt(request.getRequestUUID()) == id) {
				return request;
			}
		}
		return null;
	}
		
	private void populateRequests() {
		dbWrapper = new DBWrapper();
		sysRequests = dbWrapper.getAllDriverRequests();
	}

	public void printIds() {
		for (DriverRequest request : sysRequests) {
			System.out.println(request.getId());
		}
	}
	
	public void printAll() {
		for (DriverRequest request: sysRequests) {
			System.out.println("Id: " + request.getRequestUUID());
			System.out.println("PassengerCount: " + request.getPassanagerCount());
			System.out.println("UserID: " + request.getUserUUID());
			System.out.println();
		}
	}
}
